package exception;

public class Person {
    private int age;
    public int  getAge()
    {
        return age;
    }
    public void setAge(int age)throws IllegalAgeExpection  //throws 就像丑化说前头
    {if(age<0||age>100){
 //       throw new RuntimeException("年龄不符合要求");
       // throw  new Exception("年龄不符合要求");//
        throw new IllegalAgeExpection("年龄超过范围1-100:"+age);
    }
        this.age = age;
    }

}
